﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using MpSoft.Library.DAO.Settings;
using MpSoft.Library.DTO;
using MpSoft.Basic.Configuration;

namespace MpSoft.Library.BUSS.Settings
{
    #region  Language

    public class LanguageBUSS
    {
        private const string LANGUAGE_ALL_KEY = "Mp.language.all-{0}";
        private const string LANGUAGE_BY_ID_KEY = "Mp.language.id-{0}";

        private static void LanguageRemoveCache()
        {
            MpCache.RemoveByPattern(LANGUAGE_ALL_KEY);
            MpCache.RemoveByPattern(LANGUAGE_BY_ID_KEY);
        }

        public static int Language_Add(Language obj)
        {
            var result = LanguageDAO.Language_Add(obj);
            return result;
        }
        public static int Language_Update(Language obj)
        {
            var result = LanguageDAO.Language_Update(obj);
            return result;
        }

        public static int Language_Delete(string LanguageCode)
        {
            var result = LanguageDAO.Language_Delete(LanguageCode);
            return result;
        }

        public static Language Language_ByID(string LanguageCode)
        {
            var list = Language_Select(LanguageCode);
            if (list != null)
                return list.FirstOrDefault();
            return null;
        }

        public static List<Language> Language_Select(string LanguageCode)
        {
            return LanguageDAO.Language_Select(LanguageCode);
        }

    }

    #endregion
}
